package edu.sctu.wujiayi.month05.day20150524;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by user11 on 2015/5/24.
 */
public class More {

    public List<Teacher> sotrNumber(){
        Teachers teachers = new Teachers();

        List<Teacher> list = teachers.getList();

        for (int i = 0;i<list.size()-1;i++){

            for(int j = 0;j<list.size();j++){
                if(list.get(j).number>list.get(j+1).number){
                    list.add(j,list.get(j+1));
                    list.remove(list.get(j+2));

                }
            }
        }
       // System.out.println(list);
        return list;
    }

    public List<Student> sortStudent(){
        Teachers teachers = new Teachers();
        List<Teacher> list = teachers.getList();
        List<Student> lists = new ArrayList<>();
        for(int i = 0;i<list.size();i++){
            for(int j = 0;j<list.get(i).student.size();j++){
                lists.add(list.get(i).student.get(j));

                }

            }

        for(int i = 0;i<lists.size();i++){
          for (int j = 0;j<lists.size();j++){
              if(lists.get(j).grade>lists.get(j+1).grade){
                  lists.add(j,lists.get(j+1));
                  lists.remove(lists.get(j+2));

              }
          }
        }
        System.out.println(lists);
        return lists;
        }

    public List<Teacher> printTitol(){
        Teachers teachers = new Teachers();
        List<Teacher> list = teachers.getList();
        for (int i = 0;i<list.size();i++){
            if (list.get(i).getTitol().equals("教授")){
                System.out.println(list);
            }
        }
        return list;
    }

    }

